
class Enviroment{
    constructor(){}

    //获取获取当前环境
    getCurrentEnv(){
        return process.env.NODE_ENV;
    }

    //配置参数
    setParameterOfServer( ){
        let parm = this.getCurrentEnv();
        if( parm == "development" ){
            return {
                originUrl: "http://192.168.249.213:8080",
                appending:""
            };
        }
        if( parm == "product" ){
            return {
                originUrl: "http://frgbloghub.xyz",
                appending:"/httpdocs"
            };
        }
    }

}


//单例
let ProxyCreatEnv = (function(){
    process.instanceEnv = null;
    return function(){
        if(process.instanceEnv){
            return process.instanceEnv;
        }
        return process.instanceEnv = new Enviroment();
    }
})();

module.exports = ProxyCreatEnv();